import { CHANGECOLOR, ADDCOUNR, MINUSCOUNR } from './action-types'
import { getList } from '../api'
export function changeColor(col) {
  return {
    type: CHANGECOLOR,
    col: col
  }
}
export function addCount(n) {
  return function (dispatch, getState) {
    console.log(arguments)
    return getList().then(data => {
      dispatch({
        type: ADDCOUNR,
        num: data.length
      })
    })
  }
  // return {
  //   type: ADDCOUNR,
  //   num: n
  // }
}
export function minusCount(n) {
  return {
    type: MINUSCOUNR,
    num: n
  }
}